#ifndef COUNCILMEMBERMANAGERTEST_HPP
#define COUNCILMEMBERMANAGERTEST_HPP

#include <gtest/gtest.h>
#include "CouncilMemberManager.h"

TEST(CouncilMembersSerialization, ShoudWorkAsExpected)
{
  CouncilMember one("1", "Alexei Kolganov", "Blah", "+75555555");
  CouncilMember two("2", "Andrew Stukalin", "Blah", "+77777777");
  CouncilMemberManager manager;
  manager.insert(one);
  manager.insert(two);
  ASSERT_EQ(2, manager.size());

  manager.serialize("./council_members.csv");
  manager.deserialize("./council_members.csv");

  ASSERT_EQ(2, manager.size());
  const CouncilMember *gotOne = manager.memberById(one.id());
  const CouncilMember *gotTwo = manager.memberById(two.id());

  ASSERT_TRUE(gotOne != 0);
  ASSERT_TRUE(gotTwo != 0);
  ASSERT_EQ(one, *gotOne);
  ASSERT_EQ(two, *gotTwo);
}

#endif // COUNCILMEMBERMANAGERTEST_HPP